home *** CD-ROM | disk | FTP | other *** search
- Path: news.primenet.com!not-for-mail
- From: gbe@primenet.com (Gary Edstrom)
- Newsgroups: comp.lang.c++
- Subject: Re: Random number generator
- Date: 6 Mar 1996 13:40:02 -0700
- Organization: Sequoia Software
- Sender: root@primenet.com
- Message-ID: <313df6b0.84776542@news.primenet.com>
- References: <00001a81+0000ab27@msn.com>
- X-Posted-By: ip144.lax.primenet.com
- X-Newsreader: Forte Agent .99d/32.182
-
- On 6 Mar 96 16:50:49 -0800, Tony_Bateman@msn.com (Tony Bateman) wrote:
-
- >I need to write/acquire a good random number generator.
- >
- >Anybody have any source code in C++ or the address of a site where I
- >could download the code?
-
- One of the best formulas is from Knuth in his "Seminumerical
- Algorithms" volume of "The Art of Computer Programming" series and is
- as follows:
-
- X(n+1) = ( 6,364,136,223,846,793,005 * X(n) + 1 ) mod 2^64
-
- This formula has a period of 2^64 numbers before it starts to repeat
- and it has excellent randomness.
-
- EMail me if you would like an x86 compatible assembly language version
- of the code. I also have a C++ in-line assembly language version of
- the code.
-
- --
- Gary Edstrom <gbe@primenet.com> | Sequoia Software
- PO Box 9573 | Programming & Technical Services
- Glendale CA 91226-0573 | PGP Key ID: 0x1A0D44BD
- PGP Fingerprint: 72 AA 4F 73 05 53 89 C6 8A EE F4 EE D1 C0 13 8D
-